<?php
/**
 * Created by PhpStorm.
 * User: 86137
 * Date: 2019/3/27
 * Time: 16:44
 */

namespace App\Commons\Validators;

class MobileValidator implements Validator
{
    private static $_value;
    public function validate($attribute, $value, $parameters, $validator) : bool
    {
        static::$_value = $value;
        return  preg_match("/^1[34578]\d{9}$/", $value);
    }

    public function replacer($message, $attribute, $rule, $parameters, $validator) : string
    {
        return str_replace(':mobile', static::$_value, $message);
    }
}
